All Questions
Tagged with arrayjavascript
398 questions
3votes
1answer
91views
Merge discrete integer intervals
What it does The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
3votes
2answers
86views
Optimize Working Live Search & Highlight Function
I've written a custom Live Search & Highlight function in vanilla JS. It is working and does what I expect it to. The issue is that the more items I add to the page content to search, the slower ...
6votes
5answers
485views
Fill missing data in between available data with default value
My raw data has values on some random times: const rawData = [ {hour: 3, value: 3} , {hour: 5, value: 9} , {hour: 10, value: 5} , ] as const I would like to ...
2votes
1answer
63views
JS animated string builder
Today, I tried to write a simple function that would display the characters of my string one by one by iterating over a string containing the letters of the alphabet and showing the steps on the ...
3votes
2answers
324views
Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values
Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science ...
2votes
2answers
75views
Calculating the sum of all k-sized sub-arrays in an array using sliding window algorithm
I need to calculate the sum of all k-sized sub-arrays in an array using sliding window algorithm. Is that a valid sliding window algorithm? If not, why? ...
2votes
0answers
83views
Javascript basic search engine recipes
I have made a search engine for recipes. Requirements for this JS Project are as follow: Create a function called searchRecipes that takes all recipes and an ...
3votes
1answer
133views
3votes
0answers
59views
extracting values from an array of nested objects without duplicates
I have my solution for the below usecase but I would like to know whether is any other effective solution for the same. My Data: ...
2votes
2answers
71views
Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range
I'm trying to optimize a function that takes a sorted list of integers and tells me what is the maximum number of elements in the list between any definite size range. To be clear, the range itself ...
1vote
1answer
140views
Transform an array into object and set index for an unique key in javascript
I have a method that merges keys and indexes from an array into an object. I'm stuck with ways to compress this method, and I don't know what I can do to make it simpler. Goal get an array of objects ...
2votes
1answer
77views
Helper functions to get, set and remove from Firefox browser storage. Also, to get, push and remove from lists stored in the database
I am making a plugin for Firefox, this is (more or less) my first time working with JavaScript. Is this a reasonable design for working with both values and lists in a database? ...
3votes
1answer
133views
How can I condense my code in node.js for sorting unique values within an array?
Kattis problem - ("I've been everywhere") I would highly recommend looking at the problem through the link, however I will summarize it a bit here and explain the functionality of each part ...
4votes
1answer
170views
Array Implementation In JavaScript
Review I have written my own implementation of Array in JavaScript with the basic functionalities. Can anyone please review this code and point out the mistakes/how to make the implementation better? ...
4votes
1answer
233views
JavaScript BitArray Implementation
I am working on a project in which an array can easily grow beyond 50M in length. It's an array holding only boolean (0/1) ...